package com.xmall.controller.wx;

import com.xmall.bean.bo.AddOrDelete;
import com.xmall.bean.vo.BaseRespVo;
import com.xmall.bean.vo.CollectDataVO;
import com.xmall.bean.vo.CollectVO;
import com.xmall.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author Connor
 * @ClassName: CollectController
 * @PackageName: com.xmall.controller.wx
 * @date 2020/12/11
 * @Version 1.0
 */
@RestController
@RequestMapping("wx/collect")
public class CollectController {

    @Autowired
    CollectService collectService;

    @GetMapping("list")
    public BaseRespVo listCollection(Integer page, Integer size, Byte type) {
        CollectVO<CollectDataVO> collectVO = collectService.listCollection(page, size, type);
        return BaseRespVo.ok(collectVO);
    }

    /**
     * 高宁
     */
    @RequestMapping("addordelete")
    public BaseRespVo addOrDelete(@RequestBody AddOrDelete addOrDelete){
        Map<String,String> map = collectService.addOrDelete(addOrDelete);
        return BaseRespVo.ok(map);
    }
}
